package com.gxa.controller.baoBiaoController;

import com.gxa.common.R;
import com.gxa.pojo.*;
import com.gxa.service.baoBiaoService.ZiJinBaoBiaoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;

/**
 * @author 86156
 */
@RestController
@RequestMapping("/baoBiao/ziJinBaoBiao")
@Api(value = "资金报表功能",tags = "资金报表功能API")
@RequiresPermissions("资金报表")
public class ZiJinBaoBiaoController {

    @Autowired
    private ZiJinBaoBiaoService ziJinBaoBiaoService;


    @GetMapping(value = "/selectXianJinYingHang")
    @ApiOperation(value = "现金银行报表接口",notes = "接受参数，根据参数返回现金银行信息",httpMethod = "get", response =R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startTime",value = "开始时间",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "endTime",value = "结束时间",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "zhangHuId",value = "账户id",paramType = "query",dataType = "String",required = false)
    })
    public R selectXianJinYingHang(@RequestParam String startTime,
                                   @RequestParam String endTime,
                                   @RequestParam(required = false) String zhangHuId) throws ParseException {
        return ziJinBaoBiaoService.selectXianJinYingHang(startTime,endTime,zhangHuId);
    }

    @GetMapping(value = "/selectYingFuZhangKuanMingXi")
    @ApiOperation(value = "应付账款明细表接口",notes = "接受参数，根据参数返回应付账款明细",httpMethod = "get", response =R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startTime",value = "开始时间",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "endTime",value = "结束时间",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "gongYingShangId",value = "供应商id",paramType = "query",dataType = "String",required = false)
    })
    public R selectYingFuZhangKuanMingXi(@RequestParam String startTime,
                                         @RequestParam String endTime,
                                         @RequestParam(required = false) String gongYingShangId) throws ParseException {

        return ziJinBaoBiaoService.selectYingFuZhangKuanMingXi(startTime,endTime,gongYingShangId);
    }

    @GetMapping(value = "/selectYingShouZhangKuanMingXi")
    @ApiOperation(value = "应收账款明细表接口",notes = "接受参数，根据参数返回应收账款明细",httpMethod = "get", response =R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startTime",value = "开始时间",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "endTime",value = "结束时间",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "keHuId",value = "客户id",paramType = "query",dataType = "String",required = false)
    })
    public R selectYingShouZhangKuanMingXi(@RequestParam String startTime,
                                           @RequestParam String endTime,
                                           @RequestParam(required = false) String keHuId) throws ParseException {

        return ziJinBaoBiaoService.selectYingShouZhangKuanMingXi(startTime,endTime,keHuId);
    }

    @GetMapping(value = "/selectKeHuDuiZhangDan")
    @ApiOperation(value = "客户对账表接口",notes = "接受参数，根据参数返回客户对账明细",httpMethod = "get", response =R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startTime",value = "开始时间",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "endTime",value = "结束时间",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "keHuId",value = "客户id",paramType = "query",dataType = "String",required = true)
    })
    public R selectKeHuDuiZhangDan(@RequestParam String startTime,
                                   @RequestParam String endTime,
                                   @RequestParam String keHuId) throws ParseException {

        return ziJinBaoBiaoService.selectKeHuDuiZhangDan(startTime,endTime,keHuId);
    }

    @GetMapping(value = "/selectGongYingShangDuiZhangDan")
    @ApiOperation(value = "供应商对账表接口",notes = "接受参数，根据参数返回供应商对账明细",httpMethod = "get", response =R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startTime",value = "开始时间",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "endTime",value = "结束时间",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "gongYingShangId",value = "供应商id",paramType = "query",dataType = "String",required = true)
    })
    public R selectGongYingShangDuiZhangDan(@RequestParam String startTime,
                                            @RequestParam String endTime,
                                            @RequestParam String gongYingShangId) throws ParseException {

        return ziJinBaoBiaoService.selectGongYingShangDuiZhangDan(startTime,endTime,gongYingShangId);
    }



}
